package com.dhl.memento.theory;

/**
 * @title: Client
 * @Author danghailiang
 * @Date: 2022/8/22 15:58
 * @Version 1.0
 */
public class Client {
    public static void main(String[] args) {
        Originator originator = new Originator(100,100, 5000,1000,"0");
        System.out.println("攻击魔王前状态" + originator);
        // 保存状态集合
        Caretaker caretaker = new Caretaker();
        // 进行保存
        System.out.println("存档");
        caretaker.add(originator.saveStateMemento());
        System.out.println("攻击魔王");
        originator.setState("1");
        originator.setAtk(110);
        originator.setDef(120);
        originator.setHp(4000);
        originator.setBp(800);
        System.out.println("攻击魔王后状态" + originator);
        System.out.println("进行恢复状态，状态读档 ");
        originator.getStateMemento(caretaker.get(0));
        System.out.println("读档之后的状态" + originator);
    }
}
